﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using KVB.Common;
using Customer_Profile.eCard.DBDao;

namespace Customer_Profile.eCard
{
    public partial class CardDetail : System.Web.UI.Page
    {
        string cardno = "";
        public string card_balance = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["cardno"] != null)
            {
                cardno = Request["cardno"].ToString();
                binggrids();
            }
        }

        private void binggrids()
        {
            try
            {
                DataSet ds = DealDao.getDealsByCardno(cardno);
                rtpCparty.DataSource = ds.Tables[0].DefaultView;
                rtpCparty.DataBind();

                rptMMDeals.DataSource = ds.Tables[1].DefaultView;
                rptMMDeals.DataBind();
                if (ds.Tables[2]!=null && ds.Tables[2].Rows.Count > 0)
                {
                    gridTransfer1.DataSource = ds.Tables[2].DefaultView;
                    gridTransfer1.DataBind();
                }

                if (ds.Tables[3] != null && ds.Tables[3].Rows.Count > 0)
                {
                    gridCflows1.DataSource = ds.Tables[3].DefaultView;
                    gridCflows1.DataBind();
                }
                if (ds.Tables[4] != null && ds.Tables[4].Rows.Count > 0)
                {
                    card_balance = ds.Tables[4].Rows[0]["card_balance"].ToString();
                }

                if (ds.Tables[5] != null && ds.Tables[5].Rows.Count > 0)
                {
                    rptAttach.DataSource = ds.Tables[5].DefaultView;
                    rptAttach.DataBind();
                }
                if (ds.Tables[6] != null && ds.Tables[6].Rows.Count > 0)
                {
                    rtpSettle.DataSource = ds.Tables[6].DefaultView;
                    rtpSettle.DataBind();
                }
                if (ds.Tables[7] != null && ds.Tables[7].Rows.Count > 0)
                {
                    rptSettleAttach.DataSource = ds.Tables[7].DefaultView;
                    rptSettleAttach.DataBind();
                }
            }
            catch(Exception ex)
            {
                Response.Write(ex.ToString());
            }
        }
    }
}